import dayjs from "dayjs";
const setLineOption = (lineData: { [key: string]: number[] }) => {
  return {
    tooltip: {
      trigger: "axis",
      valueFormatter: (value: number) => value + "min",
    },
    grid: {
      top: "15%",
      left: "2%",
      right: "3%",
      bottom: "12%",
      containLabel: true,
    },
    xAxis: {
      type: "category",
      boundaryGap: false,
      data: Object.values(lineData).map(item => dayjs.unix(item[0]).format("HH:mm")),
    },
    yAxis: {
      name: "min",
      type: "value",
      nameTextStyle: {
        color: "#333333",
        padding: [0, 35, 0, 0],
      },
    },
    dataZoom: [
      {
        show: true,
        width: "93.7%",
        height: "18px",
        brushSelect: false,
        realtime: true,
        start: 0,
        end: 100,
        bottom: 0,
        borderColor: "#019BA0",
        fillerColor: "rgba(1, 155, 160, 0.2)",
        zlevel: 10000,
        handleStyle: {
          color: "#047174",
        },
      },
    ],
    series: [
      {
        name: "时间",
        type: "line",
        showSymbol: false,
        itemStyle: {
          color: "#019ba0",
        },
        smooth: true,
        data: Object.values(lineData).map(item => [dayjs.unix(item[0]).format("HH:mm"), item[1]]),
      },
    ],
  };
};
export default setLineOption;
